<?php
namespace app\crm\controller;
use think\Loader;
use think\Cache;

class Cdr extends CrmController
{
    /**
     * 加载通话记录界面
     */
    public function listCDR()
    {
        //分配增删改的权限
        $menuname = "CDR List";
        $p_menuname = $_SESSION['menu'][$menuname]; //父菜单
        $priv = $_SESSION["user_priv"][$p_menuname][$menuname];	
        $this->assign("username",$_SESSION['user_info']['username']);
        $this->assign("priv",$priv);

        $arrUsers = Loader::model('Users')->getUsersList();
        $this->assign("arrUsers",$arrUsers);

        $result = Loader::model('Department')->recursionDepartment();
        $result = Loader::model('Department')->recursionDepartmentArr($result);
        $this->assign('options', $result);
        // 模板输出
        return $this->fetch('listCDR');
    }

    public function cdrDataList()
    {
        // print_r($_REQUEST);
        $arrData = Loader::model('Cdr')->getCdrData();
        echo json_encode($arrData);
    }

    public function playRecord()
    {
        $uniqueid = $_REQUEST["uniqueid"];
        $this->assign("uniqueid",$uniqueid);
        
        $cdrData = Loader::model('Cdr')->getCdrInfo($uniqueid);
        // print_r($cdrData);
        $this->assign("cdrData",$cdrData);

        // 模板输出
        return $this->fetch('playRecord');
    }

    
    public function recordEvaluation ()
    {
        // print_r($_REQUEST);exit;
        $data = $_REQUEST;
        $data['createtime'] = date('Y-m-d H:i:s');
        $data['createuser'] = $_SESSION['user_info']['username'];
        Loader::model('Cdr')->recordEvaluation($data);

    }



}

?>